﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SalesReports.aspx.cs" Inherits="TheatreStaff_SalesReports" %>
<%@ Register TagPrefix="custom" Namespace="myControls" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script type="text/javascript">

    function displayCalendar() {
        var datePicker = document.getElementById('datePicker');
        datePicker.style.display = 'block';
    }
</script>
<script runat ="server" >
   

    protected void CreateReport(object sender, EventArgs e)
    {
        if (txtTitle.Text == "" && txtDate.Text == "")
        {
            srcMovie.FilterExpression = "title LIKE '%{0}%' OR sessiondate= '{1}'";
            //srcMovie.FilterExpression = "title LIKE 'Caroline' OR sessiondate like '10'";

        }
        else 
        if (txtTitle.Text != "" && txtDate.Text != "")
        {
            srcMovie.FilterExpression = "title LIKE '%{0}%' AND sessiondate= '{1}'";
           
        }
        else
        {

            if (txtDate.Text == "")
            {
                srcMovie.FilterExpression = "title = '{0}'";
                          
            }
            else
            {
                if (txtTitle.Text == "")
                {
                    srcMovie.FilterExpression = "sessiondate = '{1}'";
                }
            }
        }
        
    }
    //protected void CreateLabel(object sender, EventArgs e)
    //{
        
    //    switch (ddlSelect.SelectedValue)
    //    { 
    //        case "Movie":
    //            lblSearch.Text="Please enter the Movie Name";
    //            lblSearch.Visible = true;
    //            ddlMovie.Visible = true;
    //            ddlSessionDate.Visible = false;
    //            ddlSessionTime.Visible = false ;
    //            btnReport.Visible = true;
    //            lblTotal.Text = string.Empty;
    //            lblName.Text = string.Empty;
    //            break;
    //        case "Date":
    //            lblSearch.Text = "Please enter the Date";
    //            lblSearch.Visible = true;
    //            ddlSessionDate.Visible = true;
    //            ddlMovie.Visible = false;
    //            ddlSessionTime.Visible = false;
    //            btnReport.Visible = true;
    //            lblTotal.Text = string.Empty;
    //            lblName.Text = string.Empty;
    //            break;
    //        case "Session":
    //            lblSearch.Text = "Please enter the session time";
    //            lblSearch.Visible = true;
    //            ddlSessionTime.Visible = true;
    //            ddlSessionDate.Visible = false;
    //            ddlMovie.Visible = false;
    //            btnReport.Visible = true;
    //            lblTotal.Text = string.Empty;
    //            lblName.Text = string.Empty;
    //            break;
    //        default:
    //            lblSearch.Text = "Please select your report choice";
    //            lblSearch.Visible = true;
    //            //txtSearch.Visible = true;
    //            btnReport.Visible = true;
    //            break;
    //    }
    //}
    //protected void CreateReport(object sender, EventArgs e)
    //{
    //    string connectionString;
    //    Double Total = 0;
    //    connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    //    SqlConnection con = new SqlConnection(connectionString);
    //    if (ddlSelect.SelectedValue == "Movie")
    //    {
           
    //        SqlConnection con1 = new SqlConnection(connectionString);
    //        SqlCommand cmd = new SqlCommand("select OrderTotal.title,OrderTotal.AmountPaid  from OrderTotal,Cinema where OrderTotal.cinema=Cinema.CinemaId AND Cinema.TheatreId=@TheatreId AND OrderTotal.title=@title", con);
    //        string ParamString = lblId.Text;
            

            //cmd.Parameters.AddWithValue("@TheatreId", ParamString);
            //cmd.Parameters.AddWithValue("@title", ddlMovie.SelectedItem.Text);
            //cmd.Parameters.AddWithValue("@MovieTitle", txtMovieTitleI.Text);
        //    lblTotal.Text = string.Empty;
        //    lblName.Text = string.Empty;
        //    using (con)
        //    {
        //        con.Open();
        //        SqlDataReader Reader = cmd.ExecuteReader();
        //        if (Reader.HasRows)
        //        {
        //            lblTotal .Text ="<ol>";
                    
        //            while (Reader.Read())
        //            {
        //                Total = Total + Convert.ToDouble(Reader["AmountPaid"]);
        //            }
        //            lblTotal.Text = Total.ToString();
        //            lblTotal.Text = string.Format("{0:c}", Total); 
        //            lblTotal.Visible = true;
        //            lblName.Text = "The total sales for " + ddlMovie.SelectedValue;
        //            lblName.Visible = true;
        //        }
        //        else
        //        {
        //            lblName.Text = "No matching records found!";

        //        }
        //    }
        //}
        //if (ddlSelect.SelectedValue == "Date")
        //{
        //    string connectionString1;
        //    connectionString1 = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        //    SqlConnection con1 = new SqlConnection(connectionString);
        //    DateTime value = Convert.ToDateTime(ddlSessionDate.SelectedValue);
        //    SqlCommand cmd1 = new SqlCommand("select OrderTotal.sessiondate,OrderTotal.AmountPaid from OrderTotal,Cinema where OrderTotal.cinema=Cinema.CinemaId AND Cinema.TheatreId=@TheatreId AND OrderTotal.sessiondate<=@date", con1);
        //    string ParamString1 = lblId.Text;
            
        //    cmd1.Parameters.AddWithValue("@TheatreId", ParamString1);
        //    cmd1.Parameters.AddWithValue("@date", value);
        //    //cmd.Parameters.AddWithValue("@MovieTitle", txtMovieTitleI.Text);
        //    lblTotal.Text = string.Empty;
        //    lblName.Text = string.Empty;
        //    using (con1)
        //    {
        //        con1.Open();
        //        SqlDataReader Reader1 = cmd1.ExecuteReader();
        //        if (Reader1.HasRows)
        //        {
        //            lblTotal .Text ="<ol>";
                    
        //            while (Reader1.Read())
        //            {
        //                Total = Total + Convert.ToDouble(Reader1["AmountPaid"]);
        //            }
        //            lblTotal.Text = string.Format("{0:c}", Total); 
        //            lblTotal.Visible = true;
        //            lblName.Text = "The total sales for " + string.Format("{0:d}",value) ;
        //            lblName.Visible = true;
        //            Total = 0;
                    //Response.Write("<Table >")
                        
    //            }
    //            else
    //            {
    //                lblName.Text = "No matching records found!";

    //            }
    //        }

    //    }
    //    if (ddlSelect.SelectedValue == "Session")
    //    {
    //        lblTotal.Text = string.Empty;
    //        lblName.Text = string.Empty;
    //        SqlConnection con3 = new SqlConnection(connectionString);
    //        DateTime value1 = Convert.ToDateTime(ddlSessionTime.SelectedValue );


    //        SqlCommand cmd2 = new SqlCommand("select OrderTotal.sessiontime,OrderTotal.AmountPaid from OrderTotal,Cinema where OrderTotal.cinema=Cinema.CinemaId AND Cinema.TheatreId=@TheatreId AND OrderTotal.sessiontime=@sessiontime AND OrderTotal.sessiondate=@date", con3);
    //        string ParamString2 = lblId.Text;

    //        cmd2.Parameters.AddWithValue("@TheatreId", ParamString2);
    //        cmd2.Parameters.AddWithValue("@sessiontime", ddlSessionTime.SelectedValue);
    //        cmd2.Parameters.AddWithValue("@date", DateTime.Now.Date);
            
                
    //        lblTotal.Text = string.Empty;
    //        using (con3)
    //        {
    //            con3.Open();
    //            SqlDataReader Reader2 = cmd2.ExecuteReader();
    //            if (Reader2.HasRows)
    //            {
    //                lblTotal .Text ="<ol>";

    //                while (Reader2.Read())
    //                {
    //                    Total = Total + Convert.ToDouble(Reader2["AmountPaid"]);
    //                }

    //                lblTotal.Text = string.Format("{0:c}", Total);
    //                lblTotal.Visible = true;
    //                Total = 0;
    //                lblName.Text = "The total sales for " + string.Format("{0:t}", ddlSessionTime.SelectedValue) + " session";
    //                lblName.Visible = true;
    //            }
    //            else
    //            {
    //                lblName.Text = "No matching records found!";
                
    //            }
    //        }

    //    }
        
    //}
    
</script>
<script type="text/javascript">
    function showInsert() {
        var divInsert = document.getElementById('divInsert');
        divInsert.style.display = 'block';
    }
    function MM_preloadImages() { //v3.0
        var d = document; if (d.images) {
            if (!d.MM_p) d.MM_p = new Array();
            var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
                if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
        }
    }
    function MM_findObj(n, d) { //v4.01
        var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
            d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
        }
        if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
        for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
        if (!x && d.getElementById) x = d.getElementById(n); return x;
    }
    function MM_swapImage() { //v3.0
        var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
            if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
    }
    function MM_swapImgRestore() { //v3.0
        var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
    }
</script>
 <style type="text/css">
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
           
        }
    
    </style>
<style type="text/css">
.center1
{
    padding-left:320px;
}
.cinema
{
    padding-left:550px;
}
#divDisplay
{
    border:solid 1px White;
    width:400px;
    padding:15px;
    margin:0px auto;
    text-align:center;
    border:1px solid #333;
}
.C
{
    color:Green ;
    font-size:larger;
    font-weight :bolder ;
}
.I
{
    color:Maroon ;
    font-size:larger;
    font-weight :bolder ;
}
#divInsert
{
    display:none;
    border:solid 1px black;
    width:500px;
    position:absolute;
    top:200px;
    left:100px;
    padding:10px;
    background-color:Silver;
    color:Black ;
}
html
{
  background-image:url('image/back.jpg'); 

    padding:10px;
    color:White;    
  
}
.content1
{
    margin:auto;
    width:850px;
}
.column
{
    float:left;
    width:348px;
}
.selectedRow
{
    background-color:Silver;
}

.content
{
    width:950px;
    margin:auto;
        height: 197px;
}

.link
{
  margin-left:350px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link2
{
  margin-left:50px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
a
{
 color: white;
 text-decoration:underline;
 font-weight:bold;

}
a:hover
{
 color: red; 
  text-decoration:none;
  font-weight:bold;

}
.join
{
   background-color:#0099FF;
  clip:auto;
  font-weight:bold;
  font-size:large;
}
.table2
{
 border-style:solid;
   border-color:Black;
   background-color:White;
   color:Black;  
   width:900px; 
}
.row
{
   background-color:Gray;
   color:White;
}
.ticket
{
   background-color:#CC0000;
color:White;

}

.ticket:hover
{
 color: black; 
  text-decoration:none;


}
    .style1
    {
        width: 509px;
    }
    
.footer
{

     font-weight:bold;
  font-size:large;  

}
.ticket1
{
    padding-left:200px;
}
.view2
{
 padding-left:460px;  
}
.text
{
 font-weight:bold;
}
.button
{
 margin-left:250px;
}
.view3
{
    padding-left:120px;
}
.footer
{

   margin-top:250px;
}
.center
{
    padding-left:250px;
}
     .menu
{
 padding-left:150px;  

}
</style>
    <title>Movie Maintenance Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content">
  <asp:Image ID="Image1" Width="1000" Height="130" ImageUrl="~/image/tdk-jun5-bannerbatmanexclusivo2.jpg" runat="server" /><br />
<asp:HyperLink ID="HyperLink14"  CssClass="link" NavigateUrl="~/Default.aspx" runat="server">Home</asp:HyperLink>
<asp:HyperLink ID="HyperLink1"  CssClass="link2" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink> <asp:HyperLink ID="HyperLink2" CssClass="link2" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" CssClass="link2"  NavigateUrl="~/Price.aspx" runat="server">Prices</asp:HyperLink>

<br /> <br />

    <%--<td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp</td>--%>
<%--<asp:Label ID="Label5" runat="server"  Text="Theatre" CssClass="cinema" Font-Bold="True" Font-Underline="True"></asp:Label>
        <asp:Label ID="Label4" runat="server"  ForeColor="Yellow"></asp:Label>
      
&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp 
          <asp:Label ID="Label6" runat="server" Text="UserName" Font-Bold="True"></asp:Label>    <asp:LoginName ID="LoginName1" runat="server" /> 
    &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp<asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="#99CCFF" />--%>
<table class="center1" >
        <tr>
            <td>
               <asp:Label ID="Label22222" runat="server"  CssClass="menu" Text="Theatre" Font-Bold="True" Font-Underline="True"></asp:Label>  
            </td>
            <td>
                 <asp:Label ID="Label4" runat="server"  ForeColor="Yellow"></asp:Label>
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
       <%-- </tr>
 </table> --%>
    <%--<td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp</td>--%>
<%--&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp --%>
  <%--<table align="center" >
        <tr>--%>
            <td>
                <asp:Label ID="Label12" runat="server" Text="UserName" Font-Bold="True"></asp:Label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                <asp:LoginName ID="LoginName1" runat="server" /> 
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                 <asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="#99CCFF" />
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
    </table>
        <hr />
  <asp:Label ID="Label8" runat="server" Text="Maintain:" Font-Bold="True" Font-Size="Larger" Font-Underline="True"></asp:Label>
<asp:HyperLink ID="HyperLink17" runat="server" 
            NavigateUrl="~/TheatreStaff/Cinema.aspx" ForeColor="#FFCC99">[Cinemas]</asp:HyperLink>&nbsp;
    <asp:HyperLink ID="HyperLink18" runat="server"  ForeColor="#FFFF99" NavigateUrl="~/TheatreStaff/Movies.aspx">[Movies]</asp:HyperLink> &nbsp;
    <asp:HyperLink ID="HyperLink144" runat="server" NavigateUrl="~/TheatreStaff/Schedule.aspx" ForeColor="#FF9900">[Schedules]</asp:HyperLink>&nbsp;   
 <asp:HyperLink ID="HyperLink117" runat="server" NavigateUrl="~/TheatreStaff/Session.aspx" ForeColor="#FF6699">[Session Times]</asp:HyperLink>&nbsp;
  <asp:HyperLink ID="HyperLink116" runat="server" NavigateUrl="~/TheatreStaff/SessionDates.aspx" ForeColor="#66FF66">[Session Date]</asp:HyperLink>&nbsp;  
 <asp:HyperLink ID="HyperLink115" runat="server" NavigateUrl="~/TheatreStaff/SpecialTickets.aspx" ForeColor="Aqua">[Specail Price]</asp:HyperLink>&nbsp;
 <asp:HyperLink ID="HyperLink107" runat="server" NavigateUrl="~/TheatreStaff/specialday.aspx" ForeColor="#CCFF33">[Special Ticket Pricing Days]</asp:HyperLink>&nbsp; 
     <asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl="~/TheatreStaff/SalesReports.aspx" ForeColor="#CCFFFF">[Sales Report]</asp:HyperLink>&nbsp;
             <asp:HyperLink ID="HyperLink11" runat="server" NavigateUrl="~/TheatreStaff/AddNewUser.aspx" ForeColor="#66FF99">[Add New User]</asp:HyperLink>&nbsp;
  <hr />
  <%-- <br />
        <div class ="content1">--%>
        <asp:Label ID="lblId" runat="server" Visible="false" ></asp:Label>
         
        <%-- <br />
           <h3><asp:Label ID="Label1" Text ="Sales Reports" runat="server" CssClass="center" ForeColor="#FFFF99" /></h3>
            <table>
                <tr>
                    <td>
                        <asp:Label ID="Label3" runat="server" Text="Select Sales Report Option"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlSelect" AutoPostBack ="true" OnSelectedIndexChanged="CreateLabel"  runat="server">
                            <asp:ListItem Text="Select" Value ="-1" />
                            <asp:ListItem Text ="Sales for a Movie" Value ="Movie" />
                            <asp:ListItem Text ="Sales for a Date" Value ="Date" />
                            <asp:ListItem Text ="Sales for a Session" Value="Session" />
                        </asp:DropDownList>      
                    </td>
                </tr> 
                <tr>
                    <td>
                        <asp:Label ID="lblSearch" Visible ="false"  runat="server" Text=""></asp:Label>
                    </td>
                    <td>
                         <asp:DropDownList 
                        ID="ddlSessionDate" 
                         DataSourceID ="srcSessionDate" 
                         DataTextField ="sessiondate" DataTextFormatString="{0:dd/MM/yyyy}"
                         DataValueField ="sessiondate" Visible ="false"
                         runat="server" AppendDataBoundItems ="true" >
                         <asp:ListItem Text ="Select" Value ="-1" />
                        </asp:DropDownList>
                        <asp:DropDownList 
                        ID="ddlMovie" Visible ="false"
                         DataSourceID ="srcMovie" 
                         DataTextField ="MovieTitle" 
                         DataValueField ="MovieTitle" 
                         runat="server" AppendDataBoundItems ="true" >
                         <asp:ListItem Text ="Select" Value ="-1" />
                        </asp:DropDownList>
                        <asp:DropDownList 
                        ID="ddlSessionTime" 
                         DataSourceID ="srcSession" 
                         DataTextField ="sessiontime" 
                         DataValueField ="sessiontime" Visible ="false"
                         runat="server" AppendDataBoundItems ="true" >
                         <asp:ListItem Text ="Select" Value ="-1" />
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:Button ID="btnReport" Visible ="false" runat="server" OnClick="CreateReport" Text="Create Report" />
                        
                    </td> 
                </tr>
            </table> 
            
            <hr/>
            <table border="1">
                <tr>
                    <th>
                        <asp:Label ID="lblName" runat="server" Visible="false"  Text=""></asp:Label>
                    </th>
                    <th>
                        <asp:Label ID="lblTotal" runat="server" Visible="false" Text=""></asp:Label>
                    </th>--%>
                    <%--<th>
                         <asp:Label ID="Label4" runat="server" Visible="false"  Text=""></asp:Label>
                    </th>--%>   
             <%--  </tr>
            </table> --%>
         <br />   
        <asp:Label ID="Label1" runat="server"  CssClass=
        "view2"  ForeColor="#CCFFFF" Text="Sales Report" Font-Bold="True" Font-Size="X-Large"></asp:Label>
         <asp:BulletedList ID="BulletedList1" ForeColor="white" runat="server">
        <%--<asp:ListItem> When you insert the release date, please insert folowing the format: mm/dd/yyyy</asp:ListItem>--%>
        <asp:ListItem Text ="Enter both 'Movie Title' and 'Session Date' to return a unique sales result" />
        <asp:ListItem Text="Enter only 'Movie Title' to search sales for a particular movie title" />
        <asp:ListItem Text ="Enter only 'Session Date' to search sales for a paticular session date"/>
                <asp:ListItem Text ="If you want to show all records, just leave textboxs empty and click search"/>
        </asp:BulletedList>
        <br />
        <table>
            <tr>
                <td>
                    <asp:Label ID="lblm" runat="server"
                    Text="Search for a Movie."></asp:Label>
                </td>
             </tr>
             <tr>
                <td>
                    <asp:Label ID="lblt" runat="server"
                    Text="Movie Title:" AssociatedControlID="txtTitle"></asp:Label>
                </td>
                <td>
                    <asp:TextBox
                    id="txtTitle"
                    Runat="server" />
                </td>
                <td>    
                    <asp:Label ID="lbld" runat="server"
                    Text="OR/And Session Date:" AssociatedControlID="txtDate"></asp:Label> 
                </td>
                <td>   
                    <asp:TextBox
                    id="txtDate"
                    Runat="server" />
                   
                </td>
                 <%--<td>    
                    <asp:Label ID="lbl" runat="server"
                    Text="OR, Time like:" AssociatedControlID="txtTime"></asp:Label> 
                </td>
                <td>   
                    <asp:TextBox
                    id="txtTime"
                    Runat="server" />
                </td>--%>
                <td>
                    <asp:Button
                    id="btnMatch" OnClick="CreateReport"
                    Text="Search"
                    Runat="server" />    
    
                </td>
            </tr>
            <tr>
            <td colspan="7">
                 <asp:CompareValidator ID="CompareValidator1"  runat="server" 
                    ErrorMessage="Date has to be in dd/mm/yyyy format" ControlToValidate="txtDate" Operator="DataTypeCheck" 
                    Type="Date"></asp:CompareValidator>
            </td>
            </tr>
        </table>
        
        <hr />
        <table align="center"  >
        <tr>
        <td>    
            <asp:GridView ID="grdReport"  DataSourceID="srcMovie" 
                AutoGenerateColumns="False" runat="server">
                <Columns>
                    <asp:BoundField DataField="title" HeaderText="Movie Title" 
                        HeaderStyle-Font-Bold="true"   HeaderStyle-ForeColor="#FFFFCC" >
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="sessiondate" HeaderText="Date" DataFormatString="{0:d}" 
                        HeaderStyle-Font-Bold="true"   HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="sessiontime" HeaderText="Session Time"
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Adult" HeaderText="Adult Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Child" HeaderText="Child Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Senior" HeaderText="Senior Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Student" HeaderText="Student Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Pensioner" HeaderText="Pensioner Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Tickets" HeaderText="Total Tickets Sold" ReadOnly="True" 
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Total" HeaderText="Sales Total" ReadOnly="True" DataFormatString="{0:c}"
                        HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="#FFFFCC">
                        <HeaderStyle Font-Bold="True"></HeaderStyle>
                    </asp:BoundField>
                </Columns>
            </asp:GridView>
        </td>
        </tr>
        
        </table>
        
            <%--<asp:SqlDataSource ID="srcMovie" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            SelectCommand="SELECT Ordertotal.title, Ordertotal.sessiondate, 
            SUM(Ordertotal.AmountPaid) AS Total, SUM(Ordertotal.numadult) 
            AS Adult, SUM(Ordertotal.numchild) AS Child, SUM(Ordertotal.numsenior) 
            AS Senior, SUM(Ordertotal.numstudent) AS Student, 
            SUM(Ordertotal.numpensioner) AS Pensioner, SUM(Ordertotal.totalticket) 
            AS Tickets, Ordertotal.sessiontime FROM Ordertotal, Cinema WHERE  
            Ordertotal.cinema = Cinema.CinemaId AND Cinema.TheatreId = @TheatreId 
            AND Ordertotal.title=@title OR Ordertotal.sessiondate=@date
             GROUP BY 
            Ordertotal.title, Ordertotal.sessiondate, Ordertotal.sessiontime ORDER BY 
            Ordertotal.sessiondate">--%>
            <asp:SqlDataSource ID="srcMovie" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            SelectCommand="SELECT Ordertotal.title, Ordertotal.sessiondate, 
            SUM(Ordertotal.AmountPaid) AS Total, SUM(Ordertotal.numadult) 
            AS Adult, SUM(Ordertotal.numchild) AS Child, SUM(Ordertotal.numsenior) 
            AS Senior, SUM(Ordertotal.numstudent) AS Student, 
            SUM(Ordertotal.numpensioner) AS Pensioner, SUM(Ordertotal.totalticket) 
            AS Tickets, Ordertotal.sessiontime FROM Ordertotal, Cinema WHERE  
            Ordertotal.cinema = Cinema.CinemaId AND Cinema.TheatreId = @TheatreId 
            GROUP BY 
            Ordertotal.title, Ordertotal.sessiondate, Ordertotal.sessiontime ORDER BY 
            Ordertotal.sessiondate,Ordertotal.title"
            >
             
            <SelectParameters >
             <%--FilterExpression="title LIKE '%{0}%' AND sessiondate= '{1}'">--%>
            <%--AND sessiondate = #{1}#--%>
           <%-- OR  sessiontime Like '{2}%'--%>
            <asp:ControlParameter  ControlID="lblID" Name="TheatreId"/>
            </SelectParameters>     
            <FilterParameters>
                <asp:ControlParameter Name="title"  DefaultValue='%' 
                     ControlID="txtTitle" />
                <asp:ControlParameter Name="sessiondate"  ConvertEmptyStringToNull="true" DefaultValue="%"
                     ControlID="txtDate"   />
            </FilterParameters>
            
            </asp:SqlDataSource>
            
            <asp:SqlDataSource ID="srcSession" runat="server"  ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand ="SELECT DISTINCT OrderTotal.sessiontime FROM OrderTotal,Cinema WHERE Cinema.CinemaId = 
            OrderTotal.cinema AND Cinema.TheatreId=@TheatreId">
                <SelectParameters >
                    <asp:ControlParameter Name ="TheatreId" ControlID ="lblId"/>
                </SelectParameters>
            </asp:SqlDataSource>
            
             <asp:SqlDataSource ID="srcSessionDate" runat="server"  ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand ="SELECT DISTINCT OrderTotal.sessiondate FROM OrderTotal,Cinema WHERE Cinema.CinemaId = 
            OrderTotal.cinema AND Cinema.TheatreId=@TheatreId">
                <SelectParameters >
                    <asp:ControlParameter Name ="TheatreId" ControlID ="lblId"/>
                </SelectParameters>
            </asp:SqlDataSource>
            
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT OrderDate, AmountPaid FROM OrderTotal"></asp:SqlDataSource>
  <table width="100" cellpadding="15" ><tr><td>Copyright@2012 MovieTix</td><td><asp:HyperLink ID="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  CssClass="footer" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  CssClass="footer" NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  CssClass="footer" NavigateUrl="~/Login.aspx" runat="server">Log In</asp:HyperLink></td></tr></table>
     </div>  
    </form>
</body>
</html>